package com.example.backend.service;

import com.example.backend.entity.UserAdress;
import com.example.backend.mapper.UserAdressMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class UserAdressService {

    @Autowired
    private UserAdressMapper userAdressMapper;

    public int insert(UserAdress record) {
        return userAdressMapper.insert(record);
    }

    public int update(UserAdress record) {
        return userAdressMapper.update(record);
    }

    public int deleteById(String id) {
        return userAdressMapper.deleteById(id);
    }

    public UserAdress selectById(Integer id) {

        return userAdressMapper.selectById(id);
    }

    public ArrayList<UserAdress> selectByUserId(Integer userId) {
        return userAdressMapper.selectByUserId(userId);
    }

    public ArrayList<UserAdress> selectAll( ) {
        return userAdressMapper.selectAll();
    }

    public int updateNoDefault(UserAdress userAdress) {
        return userAdressMapper.setNoDefault(userAdress);
    }
}
